package org.lalib.controller.form;

import java.util.List;
import java.util.Map;

import javax.faces.bean.SessionScoped;
import javax.faces.model.SelectItem;

import org.lalib.acquire.IControllerForm;
import org.lalib.entity.object.ECategory;
import org.lalib.entity.object.variable.DropDownListVariable;
import org.lalib.entity.object.variable.EVariable;
import org.lalib.entity.object.variable.EnumVariable;
import org.springframework.stereotype.Controller;

@SessionScoped
@Controller(value = "cVariableForm")
public class CVariableForm implements IControllerForm {

	private static final long serialVersionUID = 1L;
	private boolean deleteForm = false;
	private boolean updateForm = false;

	private EVariable variable;
	private EnumVariable enumVariable = new EnumVariable();

	private DropDownListVariable dropVariable = new DropDownListVariable();

	private ECategory category;
	private VariableDefination variableDefination;

	private List<ECategory> subCategoryList;
	private List<SelectItem> variableTypeSelectItemList;
	private List<EVariable> variableListOfParentCategories;
	private List<EVariable> variableListOfSelectedCategory;

	private Map<String, String> variableTypeMap;

	private String enumValue = "", enumKey = "", dropValue = "", dropKey = "";

	public ECategory getCategory() {
		return category;
	}

	public void setCategory(ECategory category) {
		this.category = category;
	}

	public List<ECategory> getSubCategoryList() {
		return subCategoryList;
	}

	public void setSubCategoryList(List<ECategory> subCategoryList) {
		this.subCategoryList = subCategoryList;
	}

	public List<EVariable> getVariableListOfParentCategories() {
		return variableListOfParentCategories;
	}

	public void setVariableListOfParentCategories(List<EVariable> variableListOfParentCategories) {
		this.variableListOfParentCategories = variableListOfParentCategories;
	}

	public List<EVariable> getVariableListOfSelectedCategory() {
		return variableListOfSelectedCategory;
	}

	public void setVariableListOfSelectedCategory(List<EVariable> variableListOfSelectedCategory) {
		this.variableListOfSelectedCategory = variableListOfSelectedCategory;
	}

	public boolean isDeleteForm() {
		return deleteForm;
	}

	public void setDeleteForm(boolean deleteForm) {
		this.deleteForm = deleteForm;
	}

	public boolean isUpdateForm() {
		return updateForm;
	}

	public void setUpdateForm(boolean updateForm) {
		this.updateForm = updateForm;
	}

	public VariableDefination getVariableDefination() {
		return variableDefination;
	}

	public void setVariableDefination(VariableDefination variableDefination) {
		this.variableDefination = variableDefination;
	}

	public Map<String, String> getVariableTypeMap() {
		return variableTypeMap;
	}

	public void setVariableTypeMap(Map<String, String> variableTypeMap) {
		this.variableTypeMap = variableTypeMap;
	}

	public List<SelectItem> getVariableTypeSelectItemList() {
		return variableTypeSelectItemList;
	}

	public void setVariableTypeSelectItemList(List<SelectItem> variableTypeSelectItemList) {
		this.variableTypeSelectItemList = variableTypeSelectItemList;
	}

	public EVariable getVariable() {
		return variable;
	}

	public void setVariable(EVariable variable) {
		this.variable = variable;
	}

	public EnumVariable getEnumVariable() {
		return enumVariable;
	}

	public void setEnumVariable(EnumVariable enumVariable) {
		this.enumVariable = enumVariable;
	}

	public String getEnumValue() {
		return enumValue;
	}

	public void setEnumValue(String enumValue) {
		this.enumValue = enumValue;
	}

	public String getEnumKey() {
		return enumKey;
	}

	public void setEnumKey(String enumKey) {
		this.enumKey = enumKey;
	}

	public String getDropKey() {
		return dropKey;
	}

	public void setDropKey(String dropKey) {
		this.dropKey = dropKey;
	}

	public String getDropValue() {
		return dropValue;
	}

	public void setDropValue(String dropValue) {
		this.dropValue = dropValue;
	}

	public DropDownListVariable getDropVariable() {
		return dropVariable;
	}

	public void setDropVariable(DropDownListVariable dropVariable) {
		this.dropVariable = dropVariable;
	}

	public class VariableDefination {

		private String name;
		private String label;
		private String tabName;
		private String description;
		private String type;

		private boolean required = false;

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public String getLabel() {
			return label;
		}

		public void setLabel(String label) {
			this.label = label;
		}

		public String getTabName() {
			return tabName;
		}

		public void setTabName(String tabName) {
			this.tabName = tabName;
		}

		public String getDescription() {
			return description;
		}

		public void setDescription(String description) {
			this.description = description;
		}

		public boolean isRequired() {
			return required;
		}

		public void setRequired(boolean required) {
			this.required = required;
		}

		public String getType() {
			return type;
		}

		public void setType(String type) {
			this.type = type;
		}
	}
}